<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

    /**
    * @author NU SIT Bar
    * @version 2.0
    */
    Class Booking_error
    {

        private $error;
        private $info;
        private $numrows;
        private $flag;

        public function getError(){ return $this->error; }
        public function setError($value){ $this->error = $value; }
        public function getInfo(){ return $this->info; }
        public function setInfo($value){ $this->info = $value; }
        public function getNumrows(){ return $this->numrows; }
        public function setNumrows($value){ $this->numrows = $value; }
        public function getFlag(){ return $this->flag; }
        public function setFlag($value){$this->flag = $value; }

        function response_check($response){
            
            if(!isset($response)){
                $this->setFlag('error');
                $this->setError('Rest service error!');
                return FALSE;
            };

            if(isset($response->error)){
                $this->setFlag('error');
                $this->setError($response->error);
                return FALSE;
            }

            if(isset($response->num_rows)){
                $this->setFlag('numrows');
                $this->setNumrows($response->num_rows);
                return FALSE;
            }

            if(isset($response->info)){
                $this->setFlag('info');
                $this->setInfo($response->info);
                return FALSE;
            }

            return $response;    

        }

    }
?>